home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / EXAMPLES / IDRAW / SLLINES.H < prev    next >
C/C++ Source or Header  |  1980-01-05  |  3KB  |  93 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. // $Header: sllines.h,v 1.8 89/10/09 14:49:32 linton Exp $
  24. // declares classes LineSelection and MultiLineSelection.
  25.  
  26. #ifndef sllines_h
  27. #define sllines_h
  28.  
  29. #include "selection.h"
  30.  
  31. // A LineSelection draws a line.
  32.  
  33. class LineSelection : public NPtSelection {
  34. public:
  35.  
  36.     LineSelection(Coord, Coord, Coord, Coord, Graphic* = nil);
  37.     LineSelection(istream&, State*);
  38.  
  39.     Graphic* Copy();
  40.     void GetOriginal2(Coord&, Coord&, Coord&, Coord&);
  41.     int GetOriginal(const Coord*&, const Coord*&);
  42.  
  43. protected:
  44.  
  45.     void WriteData(ostream&);
  46.     RubberVertex* CreateRubberVertex(Coord*, Coord*, int, int);
  47.     Selection* CreateReshapedCopy(Coord*, Coord*, int);
  48.  
  49.     void uncacheChildren();
  50.     void getExtent(float&, float&, float&, float&, float&, Graphic*);
  51.     boolean contains(PointObj&, Graphic*);
  52.     boolean intersects(BoxObj&, Graphic*);
  53.     void draw(Canvas*, Graphic*);
  54.     void drawClipped(Canvas*, Coord, Coord, Coord, Coord, Graphic*);
  55.  
  56.     Graphic* line;        // draws the line
  57.  
  58. };
  59.  
  60. // A MultiLineSelection draws a set of connected lines with a filled
  61. // interior.
  62.  
  63. class MultiLineSelection : public NPtSelection {
  64. public:
  65.  
  66.     MultiLineSelection(Coord*, Coord*, int, Graphic* = nil);
  67.     MultiLineSelection(istream&, State*);
  68.  
  69.     Graphic* Copy();
  70.     int GetOriginal(const Coord*&, const Coord*&);
  71.  
  72. protected:
  73.  
  74.     void Init(Coord*, Coord*, int);
  75.     RubberVertex* CreateRubberVertex(Coord*, Coord*, int, int);
  76.     Selection* CreateReshapedCopy(Coord*, Coord*, int);
  77.  
  78.     void uncacheChildren();
  79.     void getExtent(float&, float&, float&, float&, float&, Graphic*);
  80.     boolean contains(PointObj&, Graphic*);
  81.     boolean intersects(BoxObj&, Graphic*);
  82.     void draw(Canvas*, Graphic*);
  83.     void drawClipped(Canvas*, Coord, Coord, Coord, Coord, Graphic*);
  84.  
  85.     Graphic* ifillmultiline;    // fills a set of connected lines
  86.     Graphic* multiline;        // draws a set of connected lines
  87.     Coord lx0, ly0, lx1, ly1;    // stores endpoints of left arrowhead
  88.     Coord rx0, ry0, rx1, ry1;    // stores endpoints of right arrowhead
  89.  
  90. };
  91.  
  92. #endif
  93.